package com.cms.pms.impl;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.cms.pms.Context;
import com.cms.pms.Store;

public class DefaultContext implements Context {

	Map<Thread, Store> storeMap = new ConcurrentHashMap<Thread, Store>();
	ThreadLocal<Store> tlstore = new ThreadLocal<Store>() {
		public Store initialValue() {
			Store store = new StoreImpl();
			storeMap.put(Thread.currentThread(), store);
			return store;
		}
	};

	@Override
	public Map<Thread, Store> getAllStore() {
		return storeMap;
	}

	@Override
	public Store getStore() {
		return tlstore.get();
	}
}
